﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using Charley.WCF.Demo.MoneyMangement.Contract;
using Charley.WCF.Demo.MoneyMangement.Service;

namespace Charley.WCF.Demo.MoneyMangement.SelfHost
{
    class Program
    {
    static void Main(string[] args)
    {
        using (ServiceHost host = new ServiceHost(typeof(MoneyService)))
        {
            host.AddServiceEndpoint(typeof(IMoneyService), new BasicHttpBinding(), "http://localhost:9999/");
            host.Opened += delegate { Console.WriteLine("Host is running"); };
            host.Closed += delegate { Console.WriteLine("Host is stopped"); };

            host.Open();
            Console.ReadLine();
            host.Close();
        }
    }
    }
}
